package com.qys.livesMall.anchor.controller.app;

import com.qys.livesMall.anchor.model.dto.task.app.SellLivesApplySaveDTO;
import com.qys.livesMall.anchor.model.vo.task.app.AppSellLivesApplyDetailVO;
import com.qys.livesMall.anchor.service.AnchorSellLivesApplyService;
import com.qys.livesMall.anchor.service.AnchorSellTaskService;
import com.qys.livesMall.common.result.R;
import com.qys.livesMall.shop.modal.vo.task.app.SellTaskDetailVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 主播直播带货申请表 前端控制器
 * </p>
 *
 * @author wzy
 * @since 2023-06-20
 */
@RestController
@Tag(name = "APP-主播开播")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@RequestMapping("/app/anchor/sell/lives")
public class AppAnchorSellLivesController {


    private final AnchorSellTaskService anchorSellTaskService;


    @GetMapping("/sellLivesDetail/{anchorSellTaskId}")
    @Operation(summary = "开播详情", parameters = {@Parameter(name = "anchorSellTaskId", description = "主播带货任务Id")})
    public R<AppSellLivesApplyDetailVO> sellLivesDetail(@PathVariable Long anchorSellTaskId) {
        return R.ok(anchorSellTaskService.sellLivesDetail(anchorSellTaskId));
    }

    @PostMapping("/applySellLives")
    @Operation(summary = "申请开播")
    public R<Void> applySellLives(@RequestBody SellLivesApplySaveDTO saveDTO) {
        anchorSellTaskService.applySellLives(saveDTO);
        return R.ok();
    }


}
